package brwarner.game 
{
	import flash.geom.Point;
	/**
	 * ...
	 * @author Brook Jensen
	 */
	public class Direction 
	{
		//Direction constants
		public static const N = 0;
		public static const NE = 1;
		public static const E = 2;
		public static const SE = 3;
		public static const S = 4;
		public static const SW = 5;
		public static const W = 6;
		public static const NW = 7;
		
		//Creates a point direction from a numeric direction
		public static function directionVector( direction:Number ):Point
		{
			switch(direction % 8) {
				case 0:
					return new Point(0, -1);
				case 1:
					return new Point(1, -1);
				case 2:
					return new Point(1, 0);
				case 3:
					return new Point(1, 1);
				case 4:
					return new Point(0, 1);
				case 5:
					return new Point(-1, 1);
				case 6:
					return new Point( -1, 0);
				case 7:
					return new Point( -1, -1);
			}
			return new Point(0, 0);
		}
		
	}

}